<template>
	<view>
		<view v-if="userList.length">
			<view v-for="item in userList" :key="index" class="userItem">
				<view :data-id="item.id" @click="homePage">
					<view class="container">
						<view class="img">
							<image v-if="item.avatar || item.user_info.avatar" :src="item.avatar || item.user_info.avatar" />
							<image v-else src="../static/sns/ry_avatar.png" />
						</view>
						<view class="name" v-if="item.user_info.name">{{ item.user_info.name }}</view>
						<view class="name" v-else>匿名用户</view>
					</view>
				</view>
			</view>
		</view>
		<view v-else class="noList">暂无报名名单</view>
	</view>
</template>

<script>
	import {
		$storage
	} from '@/utils'
	export default {
		data() {
			return {
				userList: []
			}
		},
		components: {
			// login
		},
		created: function() {},
		mounted: function() {

		},
		onShow: function() {
			console.log('onshow')

		},
		async onLoad(options) {
			const id = options.id
			await this.$u.api.getActivityDetail(id, {}).then((res) => {
				// debugger
				console.log('+++---++++', res.data.user_info)
				this.userList = res.data.user_info.data
			})
			// console.log('userList:+++', this.data.userList.user_info)
		},
		methods: {
			homePage(e) {
				console.log(e)
				const id = e.currentTarget.dataset.id
				uni.switchTab({
					url: `/pages/newUser?id=${id}`,
				})
			}
		}
	}
</script>

<style lang="scss">
	.userItem {
		padding: 20rpx 20rpx 0 20rpx;

		.container {
			border-bottom: 1rpx solid #f6f6f6;
			display: flex;
			flex-direction: row;
			align-items: center;
			padding-bottom: 20rpx;

			.img {
				width: 72rpx;
				height: 72rpx;
				border-radius: 36rpx;
				overflow: hidden;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.name {
				color: #001432;
				font-size: 30rpx;
				margin-left: 24rpx;
			}
		}
	}

	.noList {
		width: 100%;
		text-align: center;
	}
</style>
